<!--
@name:userNeeds
@author:Zhenglei
@date:16:40
@description:userNeeds
@update:2022/8/216:40
-->
<template>
  <div class="pd-20">
    <el-input v-model="content" type="textarea" :rows="35" placeholder="请输入用户需知"/>
    <p align="center" style="margin-top: 20px">
      <el-button @click="handleSave"
                 size="medium"
                 type="primary">保存
      </el-button>

    </p>
  </div>
</template>

<script>
export default {
  name: "userNeeds",
  data() {
    return {
      content: ''
    }
  },
  created() {
    this.getUserAgreement()
  },
  methods: {
    handleSave() {
      if (this.content.trim()) {
        this.post(this.api.healthMap.saveUserAgreement, {
          userAgreement: this.content,
        }).then((res) => {
          if (res.data.code === '200') {
            this.$message.success('保存成功')
          }
        })

      } else {
        this.$message.warning('请输入用户需知')

      }
    },
    getUserAgreement(){
      this.post(this.api.healthMap.getUserAgreement).then((res) => {
        if (res.data.code === '200') {
          this.content=res.data.object.userAgreement
        }
      })
    },
  },
}
</script>

<style scoped>

</style>
